﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace dianyingyuan
{
    [Serializable]
    class ZengTicket : Ticket,Iprintshow
    {
        /// <summary>
        /// 赠送人姓名
        /// </summary>
        private string zengName;

        public string ZengName
        {
            get { return zengName; }
            set { zengName = value; }
        }


        public ZengTicket(string sum, Movie name, int jiage, string time, string zengName)
            : base(sum, name, jiage, time)
        {
            this.ZengName = zengName;
        }

        public override void CalPrice()
        {
            this.Price = 0;
        }

       
        #region Iprintshow 成员

        public new void printsa()
        {
            //文件名
            string ticketFileName = this.Dianying.MovieName
                + this.Showtime.Replace(':', '-')
                + this.SeatNum + ".txt";
            FileStream st = new FileStream(ticketFileName, FileMode.Create);
            StreamWriter sw = new StreamWriter(st);
            try
            {

                sw.WriteLine("*************************");
                sw.WriteLine("         小树影院       ");
                sw.WriteLine("-------------------------");
                sw.WriteLine("电影名：" + this.Dianying.MovieName);
                sw.WriteLine("时间：" + this.Showtime);
                sw.WriteLine("座位号：" + this.SeatNum);
                sw.WriteLine("价格：" + this.Price.ToString());
                sw.WriteLine("赠送者：" + this.ZengName);
                sw.WriteLine("*************************");
                
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                sw.Close();


            }

        }

        #endregion

     
    }
}
